home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWTValSetIterator.z / RWTValSetIterator
Encoding:
Text File  |  1998-10-30  |  6.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTValSetIterator<T,C> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include<rw/tvset.h>
  13.  
  14.  
  15.  
  16.               RWTValSet<T,C> vs;
  17.           RWTValSetIterator<T,C> itr(vs);
  18.  
  19. SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!!
  20.      RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr requires the Standard C++ Library.
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  28.      RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr is supplied with TTTToooooooollllssss....hhhh++++++++ 7 to provide an iterator
  29.      interface for class RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr that is backward compatable with
  30.      the container iterators provided in TTTToooooooollllssss....hhhh++++++++ 6.x. The order of iteration
  31.      over an RRRRWWWWTTTTVVVVaaaallllSSSSeeeetttt is dependent on the supplied comparator object
  32.      parameter C as applied to the values stored in the container.  The
  33.      current item referenced by this iterator is undefined after construction
  34.      or after a call to rrrreeeesssseeeetttt(((())))....  The iterator becomes valid after being
  35.      advanced with either a preincrement or ooooppppeeeerrrraaaattttoooorrrr(((()))).  For both ooooppppeeeerrrraaaattttoooorrrr++++++++
  36.      and ooooppppeeeerrrraaaattttoooorrrr(((()))), iterating past the last element will return a value
  37.      equivalent to boolean ffffaaaallllsssseeee.  Continued increments will return a value
  38.      equivalent to ffffaaaallllsssseeee until rrrreeeesssseeeetttt(((()))) is called.
  39.  
  40. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  41.      None
  42.  
  43. EEEExxxxaaaammmmpppplllleeeessss
  44.               #include<rw/tvset.h>
  45.  
  46.  
  47.  
  48.               #include<iostream.h>
  49.           #include<rw/cstring.h>
  50.           int main(){
  51.              RWTValSet<RWCString,greater<RWCString> > a;
  52.              RWTValSetIterator<RWCString,greater<RWCString> > itr(a);
  53.              a.insert("John");
  54.              a.insert("Steve");
  55.              a.insert("Mark");
  56.           //Rejected, duplicates are not allowed
  57.              a.insert("Steve");
  58.              for(;itr();)
  59.                cout << itr.key() << endl;
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.              return 0;
  75.           }
  76.           Program Output
  77.           Steve
  78.           Mark
  79.  
  80. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  81.      John
  82.  
  83.  
  84.  
  85.               RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr<<<<TTTT,,,,CCCC>>>>(RWTValSet<T,C>&s);
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.      Creates an iterator for the set ssss.  The iterator begins in an undefined
  93.      state and must be advanced before the first element will be accessible
  94.  
  95. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  96.               RWBoolean
  97.           ooooppppeeeerrrraaaattttoooorrrr(((())))();
  98.  
  99.  
  100.      Advances sssseeeellllffff to the next element.  If the iterator has advanced past the
  101.      last element in the collection, ffffaaaallllsssseeee will be returned.  Otherwise, ttttrrrruuuueeee
  102.      will be returned.
  103.  
  104.               RWBoolean
  105.           ooooppppeeeerrrraaaattttoooorrrr++++++++();
  106.  
  107.  
  108.      Advances sssseeeellllffff to the next element.  If the iterator has been reset or
  109.      just created sssseeeellllffff will now reference the first element.  If, before
  110.      iteration, sssseeeellllffff referenced the last association in the set, sssseeeellllffff will now
  111.      reference an undefined value and ffffaaaallllsssseeee will be returned.  Otherwise, ttttrrrruuuueeee
  112.      is returned. Note: no postincrement operator is provided.
  113.  
  114. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  115.               RWTValSet<T,C>*
  116.           ccccoooonnnnttttaaaaiiiinnnneeeerrrr(((()))) const;
  117.  
  118.  
  119.      Returns a pointer to the collection being iterated over.
  120.  
  121.               T
  122.           kkkkeeeeyyyy() const;
  123.  
  124.  
  125.      Returns the value referenced by sssseeeellllffff.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTVVVVaaaallllSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               void
  141.           rrrreeeesssseeeetttt();
  142.           void
  143.           rrrreeeesssseeeetttt(RWTValSet<T,C>& s);
  144.  
  145.  
  146.      Resets the iterator so that after being advanced it will reference  the
  147.      first element of the collection.  Using rrrreeeesssseeeetttt(((()))) with no argument will
  148.      reset the iterator on the current container.  Supplying a RRRRWWWWTTTTVVVVaaaallllSSSSeeeetttt to
  149.      rrrreeeesssseeeetttt(((()))) will reset the iterator on that container.
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.